<?php
(new \Phalcon\Debug())->listen(true, true);

/**
 * The FactoryDefault Dependency Injector automatically registers the services that
 * provide a full stack framework. These default services can be overidden with custom ones.
 */
$di = new \Phalcon\Di\FactoryDefault();

/**
 * Include general services
 */
require SRC_PATH . 'config'.DS.'services.php';

/**
 * Include web environment specific services
 */
require SRC_PATH . 'config/services_web.php';

$application = new \Phalcon\Mvc\Application($di);

$application -> registerModules([
	'backstage' => [
		'className' => 'Modules\\Backstage\\Module',
		'path' => __DIR__ . '/modules/backstage/Module.php'
	],
	'frontend' => [
		'className' => 'Modules\\Frontend\\Module',
		'path' => __DIR__ . '/modules/frontend/Module.php'
	],
	'products' => [
		'className' => 'Modules\\Products\\Module',
		'path' => __DIR__ . '/modules/products/Module.php'
	],
	'uploads' => [
		'className' => 'Modules\\Uploads\\Module',
		'path' => __DIR__ . '/modules/uploads/Module.php'
	],
	'user' => [
		'className' => 'Modules\\User\\Module',
		'path' => __DIR__ . '/modules/user/Module.php'
	],
]);

$application -> handle() -> send();
/*
try {
	$application -> handle() -> send();
} catch (\Exception $e) {
	echo $e->getMessage();
}
*/